const _request = option => uni.$http.create().setConfig({ showLoading: false, ...option }).request()

export const getCourseList_api = data => _request({ url: '/course/list', data })
export const postStudy_api = data => _request({ url: '/learn/start', data, method: 'post' })
export const getCourseDetail_api = data => _request({ url: '/learn', data })
export const getWordsCount_api = data => _request({ url: '/statistics/words-count', data })
export const getWordsCountRecord_api = data => _request({ url: '/statistics/course-learn-record', data })
export const getWordsList_api = data => _request({ url: '/course-vocabulary/list-page', data })
export const postFinish_api = data => _request({ url: '/learn/finish', data, method: 'post' })
export const postExerJoin_api = data => _request({ url: '/article-exercise/join', data, method: 'post' })
export const getArticleList_api = data => _request({ url: '/course-article/list', data })
export const getExerDetail_api = data => _request({ url: '/article-exercise', data })
export const getArticleDetail_api = data => _request({ url: '/course-article', data })
export const postStartExer_api = data => _request({ url: '/article-exercise/start', data, method: 'post' })
export const postSaveAnswer_api = data => _request({ url: '/article-exercise/answer', data, method: 'post' })
export const postSubmitExer_api = data => _request({ url: '/article-exercise/submit', data, method: 'post' })
export const postLearnSubmit_api = data => _request({ url: '/learn/record', data, method: 'post' })
export const postCycle_api = data => _request({ url: '/review-cycle', data, method: 'post' })
export const postWordJoin_api = data => _request({ url: '/article-word', data, method: 'post',showLoading: true, loadingText: '加入中', loadingTime: 0 })
export const getArticleWordsList_api = data => _request({ url: '/article-word/list', data })

/** 上课 */
export const learnStart = data => _request({ url: '/learn/start', method: 'post', data });

/** 结课 */
export const learnFinish = data => _request({ url: '/learn/finish', method: 'post', data });

/** 结束本次课程 */
export const finishCourse = data => _request({ url: '/article-exercise/finish', method: 'post', data });

/** 修改课程 */
export const edirlearnCourse = data => _request({ url: '/learn/course', method: 'put', data });

/** 获取开通课程数量 */
export const courseCount = () => _request({ url: '/course/count' });

/** 获取课程所有词汇(按首字母分组) */
export const allByletter = data => _request({ data, url: '/course-vocabulary/all-by-letter' });

/** 章节列表 */
export const courseChapterList = data => _request({ url: '/course/chapter', data });

/** 获取课程剩余未学词数量 */
export const noLearncount = data => _request({ url: '/course-vocabulary/no-learn-count', data });

